#pragma once


// Copyright (c) 2010 Manuel Peinado Gallego <manuel.peinado@gmail.com>
// Distributed under the MIT license

// Texture.h : interface of the Texture class
//

#include "Selectable.h"
#include "gl.h"
#include <string>
class TextureManager;



class Texture : public Selectable
{
public:
    enum { NoTexture = INT_MAX };
    
    Texture(const std::string& fileName);
    ~Texture();

    // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    GLuint getId() const;
    bool hasAlphaChannel();

    // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    std::string getFileName() const;

    // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    // Called by the manager when the shader is registered
    // with it. Thanks to this function, the relation is two-way
    void setManager(TextureManager* sm) {  m_manager = sm; }

    // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

private:

    GLuint m_glTextureId;

    std::string m_fileName;

    // NULL until the texture is registered with a manager
    TextureManager* m_manager;

    bool m_hasAlphaChannel;
    void processDevilImage();
};

